<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>精美登录页面</title>
    <style>
        * {
            box-sizing: border-box;
            margin: 0;
            padding: 0;
        }

        body {
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            display: flex;
            justify-content: center;
            align-items: center;
            height: 100vh;
        }

        .login-box {
            background: rgba(255, 255, 255, 0.9);
            padding: 40px;
            border-radius: 10px;
            box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
            width: 100%;
            max-width: 400px;
        }

        .login-box h2 {
            text-align: center;
            color: #333;
            margin-bottom: 30px;
            font-size: 28px;
        }

        .input-group {
            margin-bottom: 20px;
            position: relative;
        }

        .input-group input {
            width: 100%;
            padding: 12px 40px;
            border: 1px solid #ddd;
            border-radius: 5px;
            font-size: 16px;
            transition: border-color 0.3s;
        }

        .input-group input:focus {
            outline: none;
            border-color: #667eea;
        }

        .input-group i {
            position: absolute;
            left: 15px;
            top: 50%;
            transform: translateY(-50%);
            color: #999;
        }

        .btn-login {
            width: 100%;
            padding: 12px;
            background: #667eea;
            color: white;
            border: none;
            border-radius: 5px;
            font-size: 16px;
            font-weight: 600;
            cursor: pointer;
            transition: background 0.3s;
        }

        .btn-login:hover {
            background: #5a67d8;
        }

        .options {
            margin-top: 20px;
            display: flex;
            justify-content: space-between;
            font-size: 14px;
        }

        .options a {
            color: #667eea;
            text-decoration: none;
        }

        .options a:hover {
            text-decoration: underline;
        }

.popup {
    display: none;
    position: fixed;
    top: 30%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: white;
    padding: 24px 32px;
    border-radius: 8px;
    border: 1px solid #b065d1;
    box-shadow: 0 10px 30px rgba(142, 68, 173, 0.3), 
                0 0 0 1000px rgba(0, 0, 0, 0.2);
    z-index: 1000;
    text-align: center;
    min-width: 280px;
    max-width: 80%;
    animation: fadeIn 0.3s ease-out;
}

.popup p {
    margin: 0;
    font-size: 18px;
    color: #8e44ad;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translate(-50%, -60%); }
    to { opacity: 1; transform: translate(-50%, -50%); }
}
    </style>
    <link rel="stylesheet" href="https://mirror.fe80.cn/font-awesome/5.15.3/css/all.min.css">
</head>
<body>
    <div class="login-box">
        <h2>用户登录</h2>
        <div>
            <div class="input-group">
                <i class="fas fa-user"></i>
                <input type="text" placeholder="用户名">
            </div>
            <div class="input-group">
                <i class="fas fa-lock"></i>
                <input type="password" placeholder="密码">
            </div>
            <button type="submit" class="btn-login">登录</button>
        </div>
        <div class="options">
            <a href="#">忘记密码？</a>
            <a href="#">立即注册</a>
        </div>
    </div>
    <div id="popup" class="popup">
        <p id="popupText"></p>
    </div>
</body>
<script>
const popup = document.getElementById('popup');
const popupText = document.getElementById('popupText');
document.querySelector('button[type="submit"]').addEventListener('click', () => {
    let username = document.querySelector('input[type="text"]').value;
    let password = document.querySelector('input[type="password"]').value;
    // 这里简单模拟验证，实际需对接后端
    if (username === 'admin' && password === '123456') {
        showPopup('登录成功！');
        setTimeout(() => {
            window.location.href = 'index.html';
        }, 1500);
    } else if (username === '') {
        showPopup('请输入用户名！');
    } else if (password === '') {
        showPopup('请输入密码！');
    } else {
        showPopup('密码错误或账号不存在！');
    }
    // showPopup('未知错误！');
    return false;
});

function showPopup(message) {
    popupText.textContent = message;
    popup.style.display = 'block';
    setTimeout(() => {
        popup.style.display = 'none';
    }, 1500);
}
</script>
</html>